package com.icbc.open.chengdu.demo.settlement.query;

import com.csii.pp.icbc.util.Util;
import com.icbc.api.DefaultIcbcClient;
import com.icbc.api.internal.util.internal.util.fastjson.JSON;
import com.icbc.api.request.SettlementAccountApplyQueryRequestV1;
import com.icbc.api.response.SettlementAccountApplyQueryResponseV1;
import com.icbc.open.chengdu.demo.BaseData;


/**
 * 结算账户交易申请单查询
 * 充值/提现/认筹/认筹退款/认筹转定金
 *
 * @author xcz
 */
public class SettlementAccountApplyQueryTest {

    public static void main(String[] args) throws Exception {
        DefaultIcbcClient client = new DefaultIcbcClient(BaseData.APP_ID, BaseData.MY_RSA_PRIVATE_KEY, BaseData.ICBC_RSA_PUBLIC_KEY);
        SettlementAccountApplyQueryRequestV1 request = new SettlementAccountApplyQueryRequestV1();
        SettlementAccountApplyQueryRequestV1.SettlementAccountApplyQueryRequestV1Biz bizContent = new SettlementAccountApplyQueryRequestV1.SettlementAccountApplyQueryRequestV1Biz();
        request.setServiceUrl(BaseData.ACCOUNT_APPLY_QUERY_URL);//API地址
        bizContent.setCorpNo(BaseData.APP_ID); //合作方机构编号
        bizContent.setCorpSerno(Util.getNonceStr(16)); //合作方交易单号
        bizContent.setOriCorpSerno("3dvknanizgma6jko"); //原合作方交易单号
        bizContent.setOutServiceCode("queryapply"); //外部服务代码
        request.setBizContent(bizContent);
        SettlementAccountApplyQueryResponseV1 response = client.execute(request);
        System.out.println(JSON.toJSONString(response));
        if (response.isSuccess() && response.getReturnCode() == 0) {
            // 业务成功处理
        } else {
            // 失败
        }

    }
}
